home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / sys_util / pminfo / pmmain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-09-18  |  7.0 KB  |  213 lines

  1. VERSION 2.00
  2. Begin Form PMMainForm 
  3.    BackColor       =   &H8000000F&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Form1"
  6.    ClientHeight    =   3195
  7.    ClientLeft      =   2430
  8.    ClientTop       =   3060
  9.    ClientWidth     =   5910
  10.    Height          =   3600
  11.    Icon            =   PMMAIN.FRX:0000
  12.    Left            =   2370
  13.    LinkMode        =   1  'Source
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   3195
  17.    ScaleWidth      =   5910
  18.    Top             =   2715
  19.    Width           =   6030
  20.    Begin CommandButton PrintButton 
  21.       Caption         =   "Save To Word"
  22.       Enabled         =   0   'False
  23.       FontBold        =   0   'False
  24.       FontItalic      =   0   'False
  25.       FontName        =   "MS Sans Serif"
  26.       FontSize        =   8.25
  27.       FontStrikethru  =   0   'False
  28.       FontUnderline   =   0   'False
  29.       Height          =   375
  30.       Left            =   2160
  31.       TabIndex        =   4
  32.       Top             =   2760
  33.       Width           =   1575
  34.    End
  35.    Begin CommandButton PMInfoButton 
  36.       Caption         =   "Get Progman Info"
  37.       FontBold        =   0   'False
  38.       FontItalic      =   0   'False
  39.       FontName        =   "MS Sans Serif"
  40.       FontSize        =   8.25
  41.       FontStrikethru  =   0   'False
  42.       FontUnderline   =   0   'False
  43.       Height          =   375
  44.       Left            =   120
  45.       TabIndex        =   1
  46.       Top             =   2760
  47.       Width           =   1575
  48.    End
  49.    Begin CommandButton QuitButton 
  50.       Caption         =   "Quit"
  51.       FontBold        =   0   'False
  52.       FontItalic      =   0   'False
  53.       FontName        =   "MS Sans Serif"
  54.       FontSize        =   8.25
  55.       FontStrikethru  =   0   'False
  56.       FontUnderline   =   0   'False
  57.       Height          =   375
  58.       Left            =   4200
  59.       TabIndex        =   3
  60.       Top             =   2760
  61.       Width           =   1575
  62.    End
  63.    Begin TextBox DDEText 
  64.       Height          =   285
  65.       Left            =   120
  66.       TabIndex        =   0
  67.       Top             =   3000
  68.       Visible         =   0   'False
  69.       Width           =   1455
  70.    End
  71.    Begin Ctl3D Ctl3D1 
  72.       CenterDialogs   =   -1  'True
  73.       ClassList       =   PMMAIN.FRX:0302
  74.       IgnoreColors    =   -1  'True
  75.       Left            =   0
  76.       Top             =   2280
  77.    End
  78.    Begin Outline PMOutline 
  79.       Height          =   2535
  80.       Left            =   120
  81.       PictureClosed   =   PMMAIN.FRX:0310
  82.       PictureLeaf     =   PMMAIN.FRX:046A
  83.       PictureMinus    =   PMMAIN.FRX:05C4
  84.       PictureOpen     =   PMMAIN.FRX:071E
  85.       PicturePlus     =   PMMAIN.FRX:0878
  86.       TabIndex        =   2
  87.       Top             =   120
  88.       Width           =   5655
  89.    End
  90. Sub Form_Load ()
  91. CenterForm PMMainForm
  92. PMMainForm.Caption = ProgTitle
  93. End Sub
  94. Sub PMInfoButton_Click ()
  95. Dim Looper As Integer
  96. On Error GoTo PMInfoError
  97. Screen.MousePointer = 11
  98. 'turn off the print button (in case this isn't the first time we're running this
  99. PrintButton.Enabled = False
  100. 'set up our DDE topics with progman so we can get the info we want
  101. DDEText.LinkTopic = "ProgMan|ProgMan"
  102. DDEText.LinkItem = "PROGMAN"
  103. DDEText.LinkMode = COLD_LINK
  104. 'get the text from program manager of all the groups
  105. DDEText.LinkRequest
  106. 'parse out the group names into an array
  107. If Not FillGroupList() Then
  108.   'if couldn't get group name list then quit
  109.   MsgBox "Unable to get list of groups.", 16, ProgTitle
  110.   Screen.MousePointer = 0
  111.   Exit Sub
  112. End If
  113. 'clear out the text so we can get the individual information for each group
  114. DDEText.Text = ""
  115. 'dimension the group information array
  116. ReDim GroupInfoList(0)
  117. 'go through each group and read in all the information
  118. For Looper = 1 To UBound(GroupList)
  119.   'set the linkitem equal to the name of the group for which we want information
  120.   DDEText.LinkItem = GroupList(Looper).Name
  121.   'turn the conversation on to suck in the information
  122.   DDEText.LinkMode = COLD_LINK
  123.   'request the info
  124.   DDEText.LinkRequest
  125.   'plug the group information into our array
  126.   If Not FillGroupInfoList(Looper) Then
  127.     MsgBox "Unable to get individual group information.", 16, ProgTitle
  128.     Screen.MousePointer = 0
  129.     Exit Sub
  130.   End If
  131. Next Looper
  132. 'compile the information into our master list
  133. If Not FillMasterList() Then
  134.   MsgBox "Unable to compile ProgMan information.", 16, ProgTitle
  135.   Screen.MousePointer = 0
  136.   Exit Sub
  137. End If
  138. 'clear the outline control
  139. PMOutline.Clear
  140. 'fill the outline with the ProgMan data
  141. FillPMOutline
  142. 'enable the print button
  143. PrintButton.Enabled = True
  144. PMInfoResume:
  145. Screen.MousePointer = 0
  146. Exit Sub
  147. PMInfoError:
  148. MsgBox "Error #" + Trim$(Str$(Err)) + " - " + Error + " - has occurred."
  149. Resume PMInfoResume
  150. End Sub
  151. Sub PrintButton_Click ()
  152. Dim Looper As Integer
  153. Dim CurLevel As Integer
  154. Dim LastLevel As Integer
  155. Dim Msg As String
  156. On Error GoTo PrintError
  157. Msg = "This will take a few moments; the screen won't be updated until "
  158. Msg = Msg + "all the information has been put into Word.  Do you want "
  159. Msg = Msg + "to continue?"
  160. 'let the user know that they're going to have to wait
  161. If MsgBox(Msg, YES_NO_QUESTION, ProgTitle) = NO Then Exit Sub
  162. 'open up Word
  163. Set OhMyWord = CreateObject("word.basic")
  164. 'maximize the window if necessary
  165. If Not OhMyWord.AppMaximize() Then OhMyWord.AppMaximize
  166. 'open a new document
  167. OhMyWord.FileNew
  168. 'set the header information
  169. OhMyWord.ViewHeader        'move to the header
  170. OhMyWord.Bold              'turn on bold
  171. OhMyWord.Insert ProgTitle  'insert my program name
  172. OhMyWord.Insert Chr$(9)    'tab over once
  173. OhMyWord.Insert Chr$(9)    'tab over again
  174. OhMyWord.Insert Format$(Date, "mmmm d, yyyy")  'insert the date
  175. OhMyWord.Bold              'turns bold back off
  176. OhMyWord.ViewHeader        'move back to the document
  177. 'switch to outline view
  178. OhMyWord.ViewOutline
  179. 'initialize level variable
  180. LastLevel = 1
  181. For Looper = 1 To UBound(MasterList)
  182.   'add the text to the document
  183.   OhMyWord.Insert MasterList(Looper).Name
  184.   'figure out indentation
  185.   CurLevel = MasterList(Looper).Level
  186.   If CurLevel = LastLevel Then          'we're at the same level; don't need to do anything
  187.   ElseIf CurLevel > LastLevel Then      'we've gone down a level
  188.     OhMyWord.OutlineDemote              'move the outline down a level
  189.   ElseIf LastLevel - CurLevel = 1 Then  'we've gone up one level
  190.     OhMyWord.OutlinePromote
  191.   Else                                  'we've gone up two levels
  192.     OhMyWord.OutlinePromote
  193.     OhMyWord.OutlinePromote
  194.   End If
  195.   'go to the next line
  196.   OhMyWord.InsertPara
  197.   'set the level indicator
  198.   LastLevel = CurLevel
  199. Next Looper
  200. 'save the document
  201. OhMyWord.FileSaveAs DOC_NAME
  202. 'move to the start of the document
  203. OhMyWord.StartOfDocument
  204. PMMainForm.WindowState = WINDOW_MINIMIZED
  205. PrintResume:
  206. Exit Sub
  207. PrintError:
  208. MsgBox "Error #" + Trim$(Str$(Err)) + " - " + Error + " - has occurred."
  209. Resume PrintResume
  210. End Sub
  211. Sub QuitButton_Click ()
  212. End Sub
  213.